load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "producer",
    srcs = [
        "event_stream.go",
        "producer_job.go",
        "replication_manager.go",
        "span_config_event_stream.go",
        "stream_event_batcher.go",
        "stream_lifetime.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/crosscluster/producer",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/ccl/crosscluster",
        "//pkg/ccl/crosscluster/replicationutils",
        "//pkg/ccl/kvccl/kvfollowerreadsccl",
        "//pkg/ccl/utilccl",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobsprotectedts",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/rangefeed",
        "//pkg/kv/kvclient/rangefeed/rangefeedcache",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/protectedts",
        "//pkg/kv/kvserver/protectedts/ptpb",
        "//pkg/multitenant/mtinfopb",
        "//pkg/repstream",
        "//pkg/repstream/streampb",
        "//pkg/roachpb",
        "//pkg/security/username",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/spanconfig/spanconfigkvsubscriber",
        "//pkg/sql",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/resolver",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/clusterunique",
        "//pkg/sql/isql",
        "//pkg/sql/parser",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/privilege",
        "//pkg/sql/sem/builtins",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/syntheticprivilege",
        "//pkg/sql/types",
        "//pkg/storage",
        "//pkg/testutils",
        "//pkg/util/ctxgroup",
        "//pkg/util/hlc",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/protoutil",
        "//pkg/util/span",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_golang_snappy//:snappy",
    ],
)

go_test(
    name = "producer_test",
    size = "large",
    srcs = [
        "main_test.go",
        "producer_job_test.go",
        "replication_manager_test.go",
        "replication_stream_test.go",
        "stream_event_batcher_test.go",
        "stream_lifetime_test.go",
    ],
    embed = [":producer"],
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/ccl/changefeedccl",
        "//pkg/ccl/crosscluster",
        "//pkg/ccl/crosscluster/replicationtestutils",
        "//pkg/ccl/kvccl/kvtenantccl",
        "//pkg/ccl/storageccl",
        "//pkg/cloud/impl:cloudimpl",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobsprotectedts",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver/protectedts",
        "//pkg/kv/kvserver/protectedts/ptpb",
        "//pkg/multitenant/mtinfopb",
        "//pkg/repstream/streampb",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/spanconfig/spanconfigkvaccessor",
        "//pkg/sql",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/resolver",
        "//pkg/sql/clusterunique",
        "//pkg/sql/distsql",
        "//pkg/sql/isql",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sessiondatapb",
        "//pkg/storage",
        "//pkg/testutils",
        "//pkg/testutils/jobutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/storageutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/span",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/uuid",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_stretchr_testify//require",
    ],
)
